public class lk2486 {
    public static void main(String[] args) {
        String s="lxvqffcj";
        String t= "vjtgatotj";
        System.out.println(appendCharacters(s, t));
    }
    public static int appendCharacters(String s, String t) {
        int n1= s.length();
        int t1 = t.length();
        int n2=0,t2=0;
        int e=0;
        while(n2<n1){
            e=s.substring(n2).indexOf(t.charAt(t2));
            System.out.println(s.substring(n2));
            if(e>=0){
                n2+=e+1;
                t2++;
            }else {
                return t1-t2;
            }
            if(n2==n1){
                return t1-t2;
            }
            if(t2==t1){
                break;
            }
        }
        return 0;
    }
}
